package com.lian.hope.mapper;

import com.lian.hope.model.po.VolunteerRegister;
import com.lian.hope.model.vo.VolunteerActivitiesVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VolunteerRegisterMapper {
    @Select("insert into volunteer_register (activity_id,user_id) values (#{activityId},#{userId})")
    void insertVolunteerRegister(Long activityId, Long userId);

    @Select("delete from volunteer_register where activity_id = #{activityId} and user_id = #{userId}")
    void deleteVolunteerRegister(Long volunteerRegister, Long userId);

    /**
     * 根据用户id获取用户所有报名活动id
     *
     * @param userId
     * @return
     */
    @Select("select activity_id from volunteer_register where user_id = #{userId}")
    List<Long> listRegisterActivitiesIdsByUserId(Long userId);

    @Select("select * from volunteer_activities where id = #{activityId}")
    VolunteerActivitiesVO getVolunteerActivitiesDetailById(Long activityId);
}
